<link href="/shop/templates/default/css/base.css" rel="stylesheet" type="text/css">
<link href="/shop/templates/default/css/seller_center.css" rel="stylesheet" type="text/css">
<div class="fixed-bar">
    <div class="item-title"><a class="back" href="index.php?act=store&op=store" title="返回<?php echo $lang['manage'];?>列表"><i class="fa fa-arrow-circle-o-left"></i></a>
        <div class="subject">
            <h3>店铺装修</h3>
            <h5><?php echo $lang['nc_store_manage_subhead'];?></h5>
        </div>
    </div>
</div>
<div class="ncsc-form-default" style="margin-top: 60px">
    <form method="post" action="/admin/modules/shop/index.php?act=store&op=save_decoration" enctype="multipart/form-data" id="my_store_form">
        <input type="hidden" name="form_submit" value="ok" />
        <input type="hidden" name="store_id" value="<?php echo $_GET['store_id']; ?>">
        <dl>
            <dt><?php echo $lang['store_setting_grade'].$lang['nc_colon'];?></dt>
            <dd>
                <p><?php echo $output['store_grade']['sg_name']; ?></p>
            </dd>
        </dl>
        <dl>
            <dt><?php echo $lang['store_setting_store_zy'].$lang['nc_colon']; ?></dt>
            <dd>
                <textarea name="store_zy" rows="2" class="textarea w400"  maxlength="50" ><?php echo $output['store_info']['store_zy'];?></textarea>
                <p class="hint"><?php echo $lang['store_create_store_zy_hint'];?></p>
            </dd>
        </dl>
        
        <dl>
            <dt><?php echo $lang['store_setting_change_label'].$lang['nc_colon'];?></dt>
            <dd>
                <div class="ncsc-upload-thumb store-logo" nctype="store_label">
                    <p><?php if(empty($output['store_info']['store_label'])){ ?>
                        <i class="icon-picture"></i>
                        <?php } else {?>
                        <img src="<?php echo UPLOAD_SITE_URL.'/'.ATTACH_STORE.'/'.$output['store_info']['store_label'];?>" />
                        <?php }?></p>
                </div>
                <div class="ncsc-upload-btn"> <a href="javascript:void(0);"><span>
          <input type="file" hidefocus="true" size="1" class="input-file" name="store_label" id="storeLablePic" nc_type="change_store_label"/>
          </span>
                    <p><i class="icon-upload-alt"></i>图片上传</p>
                </a> </div>
                <p class="hint"><?php echo $lang['store_setting_label_tip'];?></p>
            </dd>
        </dl>
        <dl>
            <dt><?php echo $lang['store_setting_change_banner'].$lang['nc_colon'];?> </dt>
            <dd>
                <div class="ncsc-upload-thumb store-banner" nctype="store_banner">
                    <p><?php if(empty($output['store_info']['store_banner'])){?>
                        <i class="icon-picture"></i>
                        <?php }else{?>
                        <img src="<?php echo UPLOAD_SITE_URL.'/'.ATTACH_STORE.'/'.$output['store_info']['store_banner'];?>" />
                        <?php }?></p>
                </div>
                <div class="ncsc-upload-btn"> <a href="javascript:void(0);"><span>
          <input type="file" hidefocus="true" size="1" class="input-file" name="store_banner" id="storeBannerPic" nc_type="change_store_banner"/>
          </span>
                    <p><i class="icon-upload-alt"></i>图片上传</p>
                </a> </div>
                <p class="hint"><?php echo $lang['store_setting_banner_tip'];?></p>
            </dd>
        </dl>
        <dl class="setup store-logo">
            <dt><?php echo $lang['store_setting_change_avatar'].$lang['nc_colon'];?> </dt>
            <dd>
                <p>
                    <img src="<?php if(empty($output['store_info']['store_avatar'])){ echo UPLOAD_SITE_URL.'/'.ATTACH_COMMON.DS.$output['setting_config']['default_store_avatar'];}else{ echo UPLOAD_SITE_URL.'/'.ATTACH_STORE.'/'.$output['store_info']['store_avatar'];}?>" nc_type="store_avatar" />
                </p>
                <p>
                    <input type="hidden" value="" name="store_avatar" id="store_avatar">
                    <input name="_pic" type="file"  hidefocus="true" id="_pic"/>
                </p>
                <p class="hint"><?php echo $lang['store_setting_sign_tip'];?></p>
            </dd>
        </dl>
        <?php if($output['subdomain'] == '1'){?>
        <dl>
            <dt><?php echo $lang['store_setting_uri'].$lang['nc_colon'];?></dt>
            <dd>
                <?php if($output['subdomain_edit'] == '1' || empty($output['store_info']['store_domain'])){?>
                <p>
                    <input type="text" class="text"  name="store_domain" value="<?php echo $output['store_info']['store_domain'];?>"  />
                    &nbsp;<?php echo '.'.SUBDOMAIN_SUFFIX;?> &nbsp;</p>
                <p class="hint"><?php echo $lang['store_setting_uri_tip'];?>: <?php echo $output['setting_config']['subdomain_length'];?>
                    <?php if($output['subdomain_edit'] == '1'){?>
                    &nbsp; &nbsp;<?php echo $lang['store_setting_domain_times'];?>: <?php echo $output['store_info']['store_domain_times'];?> &nbsp; &nbsp;<?php echo $lang['store_setting_domain_times_max'];?>: <?php echo $output['subdomain_times'];?>
                    <?php }else {?>
                    &nbsp; &nbsp;<?php echo $lang['store_setting_domain_notice'];?>
                    <?php }?>
                </p>
                <?php }else {?>
                <p><?php echo $output['store_info']['store_domain'];?><?php echo '.'.SUBDOMAIN_SUFFIX;?> &nbsp;</p>
                <p class="hint"><?php echo $lang['store_setting_domain_tip'];?>
                    <?php if($output['setting_config']['subdomain_edit'] == '1'){?>
                    &nbsp; &nbsp;<?php echo $lang['store_setting_domain_times'];?>: <?php echo $output['store_info']['store_domain_times'];?> &nbsp; &nbsp;<?php echo $lang['store_setting_domain_times_max'];?>: <?php echo $output['subdomain_times'];?>
                    <?php }?>
                </p>
                <?php }?>
            </dd>
        </dl>
        <?php }?>
        <div class="bottom">
            <label class="submit-border"><input type="submit" class="submit" value="<?php echo $lang['store_goods_class_submit'];?>" /></label>
        </div>
    </form>
</div>
<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL;?>/js/ajaxfileupload/ajaxfileupload.js"></script>
<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL;?>/js/jquery.Jcrop/jquery.Jcrop.js"></script>
<link href="<?php echo RESOURCE_SITE_URL;?>/js/jquery.Jcrop/jquery.Jcrop.min.css" rel="stylesheet" type="text/css" id="cssfile2" />
<script type="text/javascript">
    var SITEURL = "<?php echo SHOP_SITE_URL; ?>";
    //裁剪图片后返回接收函数
    function call_back(picname){
        $('#store_avatar').val(picname);
        $('img[nc_type="store_avatar"]').attr('src','<?php echo UPLOAD_SITE_URL.'/'.ATTACH_STORE;?>/'+picname);
        $('#_pic').val('');
    }
    $(function(){
        $('#_pic').change(uploadChange);
        function uploadChange(){
            var filepath=$(this).val();
            var extStart=filepath.lastIndexOf(".");
            var ext=filepath.substring(extStart,filepath.length).toUpperCase();
            if(ext!=".PNG"&&ext!=".GIF"&&ext!=".JPG"&&ext!=".JPEG"){
                alert("file type error");
                $(this).attr('value','');
                return false;
            }
            if ($(this).val() == '') return false;
            ajaxFileUpload();

        }
        function ajaxFileUpload()
            {
            $.ajaxFileUpload({
                        url:'/index.php?act=admincut&op=pic_upload&form_submit=ok&&uploadpath=<?php echo ATTACH_STORE;?>',
                        secureuri:false,
                        fileElementId:'_pic',
                        dataType: 'json',
                        success: function (data, status)
                        {
                            if (data.status == 1){
                                ajax_form('cutpic','<?php echo $lang['nc_cut'];?>','/index.php?act=admincut&op=pic_cut&x=100&y=100&resize=1&url='+data.url,680);
                            }else{
                                alert(data.msg);$('#_pic').bind('change',uploadChange);
                            }
                        },
                        error: function (data, status, e)
                        {
                            alert('上传失败');$('#_pic').bind('change',uploadChange);
                        }
                    }
            )
        };
        $('input[nc_type="change_store_banner"]').change(function(){
            var src = getFullPath($(this)[0]);
            $('div[nctype="store_banner"]').find('p').html('<img src="'+src+'">');
        });
        $('input[nc_type="change_store_label"]').change(function(){
            var src = getFullPath($(this)[0]);
            $('div[nctype="store_label"]').find('p').html('<img src="'+src+'">');
        });
        jQuery.validator.addMethod("domain", function(value, element) {
            return this.optional(element) || /^[\w\-]+$/i.test(value);
        }, "");
        $('#my_store_form').validate({
            rules : {
            <?php if(($output['subdomain'] == '1') && ($output['subdomain_edit'] == '1' || empty($output['store_info']['store_domain']))){?>
            store_domain: {
                domain: true,
                        rangelength:[<?php echo $output['subdomain_length'][0];?>, <?php echo $output['subdomain_length'][1];?>]
            }
        <?php }?>
    },
        messages : {
        <?php if(($output['subdomain'] == '1') && ($output['subdomain_edit'] == '1' || empty($output['store_info']['store_domain']))){?>
                store_domain: {
                    domain: '<?php echo $lang['store_setting_domain_valid'];?>',
                            rangelength:'<?php echo $lang['store_setting_domain_rangelength'];?>'
                }
            <?php }?>
        }
    });

    });
</script>